home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / utilit~1 / futilsrc.zoo / fileutil / src / cp-aux.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-19  |  1.8 KB  |  59 lines

  1. /* cp-aux.c  -- file copying (auxiliary routines)
  2.    Copyright (C) 1989-1991 Free Software Foundation.
  3.  
  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 2, or (at your option)
  7.    any later version.
  8.  
  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU General Public License
  15.    along with this program; if not, write to the Free Software
  16.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18.    Written by Torbjorn Granlund, Sweden (tege@sics.se). */
  19.  
  20. #include <stdio.h>
  21.  
  22. #include "cp.h"
  23.  
  24. extern char *program_name;
  25.  
  26. void
  27. usage (reason)
  28.      char *reason;
  29. {
  30.   if (reason != NULL)
  31.     fprintf (stderr, "%s: %s\n", program_name, reason);
  32.  
  33.   fprintf (stderr, "\
  34. Usage: %s [options] source dest\n\
  35.        %s [options] source... directory\n\
  36. Options:\n\
  37.        [-abdfilprsuvxPR] [-S backup-suffix] [-V {numbered,existing,simple}]\n\
  38.        [+backup] [+no-dereference] [+force] [+interactive] [+one-file-system]\n\
  39.        [+preserve] [+recursive] [+update] [+verbose] [+suffix=backup-suffix]\n\
  40.        [+version-control={numbered,existing,simple}] [+archive] [+path]\n\
  41.        [+link] [+symbolic-link]\n", program_name, program_name);
  42.  
  43.   exit (2);
  44. }
  45.  
  46. int
  47. is_ancestor (sb, ancestors)
  48.      struct stat *sb;
  49.      struct dir_list *ancestors;
  50. {
  51.   while (ancestors != 0)
  52.     {
  53.       if (ancestors->ino == sb->st_ino && ancestors->dev == sb->st_dev)
  54.     return 1;
  55.       ancestors = ancestors->parent;
  56.     }
  57.   return 0;
  58. }
  59.